﻿namespace Microsoft.SharePoint.Client
{
    using System;
    using System.ComponentModel;

    [ScriptType("SP.Form", ServerTypeId="{50aaca3c-fa54-47d2-b946-a2839ee956a9}")]
    public class Form : ClientObject
    {
        [EditorBrowsable(EditorBrowsableState.Never)]
        public Form(ClientRuntimeContext Context, ObjectPath ObjectPath) : base(Context, ObjectPath)
        {
        }

        protected override bool InitOnePropertyFromJson(string peekedName, JsonReader reader)
        {
            bool flag = base.InitOnePropertyFromJson(peekedName, reader);
            if (!flag)
            {
                string str = peekedName;
                if (str == null)
                {
                    return flag;
                }
                if (!(str == "ServerRelativeUrl"))
                {
                    if (str == "Id")
                    {
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["Id"] = reader.ReadGuid();
                        return flag;
                    }
                    if (str == "FormType")
                    {
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["FormType"] = reader.ReadEnum<PageType>();
                    }
                    return flag;
                }
                flag = true;
                reader.ReadName();
                base.ObjectData.Properties["ServerRelativeUrl"] = reader.ReadString();
            }
            return flag;
        }

        [Remote]
        public PageType FormType
        {
            get
            {
                base.CheckUninitializedProperty("FormType");
                return (PageType) base.ObjectData.Properties["FormType"];
            }
        }

        [Remote]
        public Guid Id
        {
            get
            {
                base.CheckUninitializedProperty("Id");
                return (Guid) base.ObjectData.Properties["Id"];
            }
        }

        [Remote]
        public string ServerRelativeUrl
        {
            get
            {
                base.CheckUninitializedProperty("ServerRelativeUrl");
                return (string) base.ObjectData.Properties["ServerRelativeUrl"];
            }
        }
    }
}

